﻿@model Chillis.CRM.Web.Models.Publicacion.AtencionModel
@{
    ViewBag.Title = "AtenderComentario";
}
<script>
    $(function () {

        $('#btnRegistrar').click(function () {

            var replica = $('#txtReplica').val();
            var idComentario = $('#hddIdComentario').val();
            var idTipoComentario = $('#selTipoComentario').val();
            var idClaseComentario = $('#selClaseComentario').val();

            if (replica == '') {
                alert('Debe ingresar una replica para el comentario')
            }
            else {
                $.ajax({
                    url: '@Url.Action("RegistrarComentario", "Publicacion")',
                    type: "POST",
                    dataType: "json",
                    data: {
                        'IdComentario': idComentario,
                        'IdTipoComentario': idTipoComentario,
                        'IdClaseComentario': idClaseComentario,
                        'Replica' : replica
                    },
                    success: function (data) {
                        alert("Se Grabo Correctamente!");
                    }
                })
            }


        });

        $('#btnVolver').click(function () {
            var ruta = '@Url.Action("PendientesAtencion", "Publicacion")';

            window.location.href = ruta;
        });

    });
</script>

<h1>
    Atender Comentario</h1>
<fieldset>
    <table width="100%" border="0">
        <tr>
            <td colspan="9" class="td_alto">
            </td>
        </tr>
        <tr>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                Seguidor :
            </td>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                @Html.DisplayFor(model => model.Seguidor)
                @Html.HiddenFor(model => model.IdComentario, new { Id = "hddIdComentario" })
            </td>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                &nbsp;
            </td>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                &nbsp;
            </td>
            <td width="5">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="9" class="td_alto">
            </td>
        </tr>
        <tr>
            <td width="5">
                &nbsp;
            </td>
            <td>
                @Html.LabelFor(model => model.Contenido)
            </td>
            <td width="5">
                &nbsp;
            </td>
            <td colspan="5">
                @Html.DisplayFor(model => model.Contenido)
            </td>
        </tr>
        <tr>
            <td colspan="9" class="td_alto">
            </td>
        </tr>
        <tr>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                Tipo Comentario :
            </td>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                <select id="selTipoComentario">
                    @foreach (var item in Model.ListaTipoComentario)
                    {
                        if (item.IdTipoComentario == Model.IdTipoComentario)
                        {
                        <option value="@item.IdTipoComentario" selected="selected">@item.Descripcion</option>   
                        }
                        else
                        {
                        <option value="@item.IdTipoComentario">@item.Descripcion</option>   
                        }

                    }
                </select>
            </td>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                Clase Comentario :
            </td>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                <select id="selClaseComentario">
                    @foreach (var item in Model.ListaClaseComentario)
                    {
                        if (item.IdClaseComentario == Model.IdClaseComentario)
                        {
                        <option value="@item.IdClaseComentario" selected="selected">@item.Descripcion</option>
                        }
                        else
                        { 
                        <option value="@item.IdClaseComentario">@item.Descripcion</option>
                        }

                    }
                </select>
            </td>
            <td width="5">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="9" class="td_alto">
            </td>
        </tr>
        <tr>
            <td width="5">
                &nbsp;
            </td>
            <td>
                @Html.LabelFor(model => model.Replica)
            </td>
            <td width="5">
                &nbsp;
            </td>
            <td colspan="5">
                @Html.TextAreaFor(model => model.Replica, new { Id = "txtReplica", Rows = 4, Cols = 80 })
            </td>
        </tr>
        <tr>
            <td colspan="9" class="td_alto">
            </td>
        </tr>
        <tr>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                &nbsp;
            </td>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                &nbsp;
            </td>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                <input type="button" value="Registrar" class="boton" id="btnRegistrar" />
                <input type="button" value="Volver" class="boton" id="btnVolver" />
            </td>
            <td width="5">
                &nbsp;
            </td>
            <td width="20%">
                &nbsp;
            </td>
            <td width="5">
                &nbsp;
            </td>
        </tr>
    </table>
</fieldset>
